﻿@model IEnumerable<LeadMaster.Models.LeadsReplacement>

@{
    ViewBag.Title = "Index";
}

<div class="spacer"></div>
<h2>Leads Replacements</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table class="listtable contactstable" cellspacing="0" cellpadding="0">
    <tr>
        <th style="width: 300px" class="tableheader">
            @Html.DisplayNameFor(model => model.Title)
        </th>
        <th style="width: 300px;" class="tableheader">
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th class="tableheader">
            @Html.DisplayNameFor(model => model.Version)
        </th>
        <th class="tableheader">
            @Html.DisplayNameFor(model => model.DocType)
        </th>
        <th class="tableheader"></th>
    </tr>

@foreach (var item in Model) {
    <tr>     
        <td>
            @Html.DisplayFor(modelItem => item.Title)
        </td>
        <td style="text-align: left;">
            @if (item.DocType!="T")
            {
                <a href="~/Docs/LeadsReplacementDocs/@(item.Filename)">
                    @Html.DisplayFor(modelItem => item.Filename)
                </a>
            }
            else
            {
             @Html.DisplayFor(modelItem => item.Description)       
            }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Version)
        </td>
        <td>
        @switch (item.DocType)
        {
            case "T":
                @: Text
                break;
            case "P":
                @: PDF
                break;
            case "W":
                @: Word
                break;
            default:
                break;
        }
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.LeadsReplacementID }) |
            @Html.ActionLink("Details", "Details", new { id = item.LeadsReplacementID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.LeadsReplacementID })
        </td>
    </tr>
}

</table>
